<template>
  <div id="app">
    <router-view />
  </div>
</template>
<script>
import { remindMeList } from "@/api/work/process";
import { getToken } from '@/utils/auth';
export default  {
  name:  'App',
  data() {
    return {
      message : ''
    }
  },
  created() {
      this.getTanKuang()
  },
   methods: {
      getTanKuang(){
          var token = getToken();
          if(undefined!=token){
              remindMeList().then(response => {
                if (response.code === 200&&response.data!=undefined) {
                  console.log(response.data)
                  response.data.forEach((item,index)=>{
                    if(this.message != ''){
                        this.message = this.message +"<br/>" +item.nickName + "已提交审核";//+ "-任务名:"+item.workName;
                    }else{
                        this.message = item.nickName + "已提交审核";//+ "-任务名:"+item.workName;
                    }   
                  })
                  var lengths = response.data.length;
                  if(this.message!=''){
                    window.setInterval(() => {
                      this.$notify.info({
                          title: '消息',
                          duration: 20000,
                          dangerouslyUseHTMLString: true,
                          message: "您有："+lengths +"项工作待审核，请及时处理",
                          type: 'warning',
                          position: 'top-right'
                      });
                    }, 30000)
                  }
                }
              });
          }
      },
   }
}
</script>
